﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BO.Algorithm
{
   public  class Sort
    {
       public static void InsertionSort(int[] array)
       {
           if (array.Length < 1)
               return;
          // var sortedArray = new int[array.Length];
           var key=int.MaxValue;
           var i=-1;
           for (var j = 1; j < array.Length; j++)
           {
               key = array[j];
               i = j - 1;
               while (i >= 0 && array[i] > key)
               {
                   array[i + 1] = array[i];               
                   array[i] = key;
                   --i;
               }
           }
       }
    }
}
